home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / g_man / cat3 / OpenGL-ftn / fglfog.z / fglfog
Text File  |  1998-10-20  |  20KB  |  346 lines

  1.  
  2.  
  3.  
  4. ffffggggllllFFFFoooogggg((((3333GGGG))))                     OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                     ffffggggllllFFFFoooogggg((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ffffggggllllFFFFooooggggffff,,,, ffffggggllllFFFFooooggggiiii,,,, ffffggggllllFFFFooooggggffffvvvv,,,, ffffggggllllFFFFooooggggiiiivvvv - specify fog parameters
  10.  
  11.  
  12. FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  13.      SUBROUTINE ffffggggllllFFFFooooggggffff( INTEGER*4 _p_n_a_m_e,
  14.                          REAL*4 _p_a_r_a_m )
  15.      SUBROUTINE ffffggggllllFFFFooooggggiiii( INTEGER*4 _p_n_a_m_e,
  16.                          INTEGER*4 _p_a_r_a_m )
  17.  
  18.  
  19. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  20.      _p_n_a_m_e   Specifies a single-valued fog parameter.  GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE,
  21.              GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY, GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT, GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD, and GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX are
  22.              accepted.
  23.  
  24.      _p_a_r_a_m   Specifies the value that _p_n_a_m_e will be set to.
  25.  
  26. FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  27.      SUBROUTINE ffffggggllllFFFFooooggggffffvvvv( INTEGER*4 _p_n_a_m_e,
  28.                           CHARACTER*8 _p_a_r_a_m_s )
  29.      SUBROUTINE ffffggggllllFFFFooooggggiiiivvvv( INTEGER*4 _p_n_a_m_e,
  30.                           CHARACTER*8 _p_a_r_a_m_s )
  31.  
  32.  
  33. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  34.      _p_n_a_m_e
  35.           Specifies a fog parameter.  GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE, GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY,
  36.           GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT, GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD, GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX, GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR, and
  37.           GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX are accepted.
  38.  
  39.      _p_a_r_a_m_s
  40.           Specifies the value or values to be assigned to _p_n_a_m_e.  GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR
  41.           requires an array of four values to specify the RGBA components of
  42.           the fog color.  GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX requires an array of four
  43.           values to specify a reference point in eye-space coordinates, and a
  44.           Z offset in eye-space coordinates.  All other parameters accept an
  45.           array containing only a single value.
  46.  
  47. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  48.      Fog is initially disabled.  While enabled, fog affects rasterized
  49.      geometry, bitmaps, and pixel blocks, but not buffer clear operations. To
  50.      enable and disable fog, call ffffggggllllEEEEnnnnaaaabbbblllleeee and ffffggggllllDDDDiiiissssaaaabbbblllleeee with argument
  51.      GGGGLLLL____FFFFOOOOGGGG.
  52.  
  53.      ffffggggllllFFFFoooogggg assigns the value or values in _p_a_r_a_m_s to the fog parameter
  54.      specified by _p_n_a_m_e.  The following values are accepted for _p_n_a_m_e:
  55.  
  56.      GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE         _p_a_r_a_m_s is a single integer or floating-point value
  57.                          that specifies the equation to be used to compute the
  58.                          fog blend factor, f.  Four symbolic constants are
  59.                          accepted:  GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR, GGGGLLLL____EEEEXXXXPPPP, GGGGLLLL____EEEEXXXXPPPP2222, and
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ffffggggllllFFFFoooogggg((((3333GGGG))))                     OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                     ffffggggllllFFFFoooogggg((((3333GGGG))))
  71.  
  72.  
  73.  
  74.                          GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS.  The equations corresponding to
  75.                          these symbolic constants are defined below.  The
  76.                          initial fog mode is GGGGLLLL____EEEEXXXXPPPP.
  77.  
  78.      GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY      _p_a_r_a_m_s is a single integer or floating-point value
  79.                          that specifies density, the fog density used in both
  80.                          exponential fog equations.  Only nonnegative
  81.                          densities are accepted.  The initial fog density is
  82.                          1.
  83.  
  84.      GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT        _p_a_r_a_m_s is a single integer or floating-point value
  85.                          that specifies start, the near distance used in the
  86.                          linear fog equation.  The initial near distance is 0.
  87.  
  88.      GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD          _p_a_r_a_m_s is a single integer or floating-point value
  89.                          that specifies end, the far distance used in the
  90.                          linear fog equation.  The initial far distance is 1.
  91.  
  92.      GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX        _p_a_r_a_m_s is a single integer or floating-point value
  93.                          that specifies i , the fog color index.  The initial
  94.                                          f
  95.                          fog index is 0.
  96.  
  97.      GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR        _p_a_r_a_m_s contains four integer or floating-point values
  98.                          that specify C , the fog color.  Integer values are
  99.                                        f
  100.                          mapped linearly such that the most positive
  101.                          representable value maps to 1.0, and the most
  102.                          negative representable value maps to -1.0.
  103.                          Floating-point values are mapped directly.  After
  104.                          conversion, all color components are clamped to the
  105.                          range [0,1].  The initial fog color is (0,0,0,0).
  106.  
  107.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX
  108.                          _p_a_r_a_m_s contains four integer or floating-point
  109.                          values.  The first three specify a reference point as
  110.                          X, Y, and Z eye coordinates.  The fourth specifies a
  111.                          Z offset in eye coordinates.  The offset is used to
  112.                          modify z in the fog equations described below, so
  113.                          that bright objects (such as emissive objects
  114.                          representing light sources) will have a more
  115.                          realistic appearance in heavily-fogged environments.
  116.                          The significance of the reference point is discussed
  117.                          below.  Integer values are mapped linearly such that
  118.                          the most positive representable value maps to 1.0,
  119.                          and the most negative representable value maps to
  120.                          -1.0.  Floating-point values are mapped directly.
  121.                          The initial value is (0,0,0,0).
  122.  
  123.      Fog blends a fog color with each rasterized pixel fragment's
  124.      posttexturing color using a blending factor f.  Factor f is computed in
  125.      one of four ways, depending on the fog mode.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                                                                         PPPPaaaaggggeeee 2222
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. ffffggggllllFFFFoooogggg((((3333GGGG))))                     OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                     ffffggggllllFFFFoooogggg((((3333GGGG))))
  139.  
  140.  
  141.  
  142.      Let z be the distance in eye coordinates from the origin to the fragment
  143.      being fogged.  If GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____SSSSGGGGIIIIXXXX is enabled, subtract the Z offset
  144.      specified by GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX from z, and clamp the result so
  145.      that it is greater than or equal to zero.
  146.  
  147.      The equation for GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR fog is
  148.  
  149.                                                  end - z___________
  150.                                   f =
  151.                                       end - start
  152.  
  153.  
  154.  
  155.      The equation for GGGGLLLL____EEEEXXXXPPPP fog is
  156.  
  157.                                       -density * z
  158.                                  f = e
  159.  
  160.  
  161.  
  162.      The equation for GGGGLLLL____EEEEXXXXPPPP2222 fog is
  163.  
  164.                                                   2
  165.                                     -(density * z)
  166.                                f = e
  167.  
  168.  
  169.  
  170.      The blending factor for GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS fog is determined by
  171.      interpolating a set of application-defined control points.
  172.      ffffggggllllFFFFooooggggFFFFuuuunnnnccccSSSSGGGGIIIISSSS is used to specify the control points.  Each control point
  173.      consists of a pair of floating-point numbers.  The first number of the
  174.      pair specifies a value of z, and the second number of the pair specifies
  175.      a value of f.  The GL fits a curve through all the control points.  This
  176.      curve may be piecewise linear or it may be smoothed, but it will pass
  177.      through the control points exactly (limited only by the resolution of the
  178.      implementation).  If a given z is less than or equal to the z of the
  179.      first control point, then the resulting value of f is the f of the first
  180.      control point.  If z is greater than or equal to the z of the last
  181.      control point, then the resulting value of f is the f of the last control
  182.      point.  Otherwise, f is determined by finding the point on the curve that
  183.      corresponds to the given z.
  184.  
  185.  
  186.      Regardless of the fog mode, f is clamped to the range [0,1] after it is
  187.      computed.  Then, if the GL is in RGBA color mode, the fragment's color C
  188.                                                                              r
  189.      is replaced by
  190.  
  191.  
  192.                                  C ' = fC +(1-f)C
  193.                                   r      r       f
  194.  
  195.      In color index mode, the fragment's color index i  is replaced by
  196.                                                       r
  197.  
  198.                                  i ' = i +(1-f)i
  199.                                   r     r       f
  200.  
  201. NNNNOOOOTTTTEEEESSSS
  202.      In perspective projections, a Z offset in eye coordinates will map to
  203.      different Z offsets in window coordinates at various points in the range
  204.      of Z.  Machines that evaluate the fog blending factor by using a window Z
  205.      coordinate to index a table must therefore compute the window-coordinate
  206.      Z offset relative to some reference point.  This is the purpose of the
  207.  
  208.  
  209.  
  210.                                                                         PPPPaaaaggggeeee 3333
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. ffffggggllllFFFFoooogggg((((3333GGGG))))                     OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                     ffffggggllllFFFFoooogggg((((3333GGGG))))
  218.  
  219.  
  220.  
  221.      reference point specified by the first three values in _p_a_r_a_m_s when _p_n_a_m_e
  222.      is GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX.  For best fog accuracy in perspective
  223.      projections, this reference point must be close to the objects being
  224.      fogged.
  225.  
  226.      In parallel projections the window-coordinate Z offset does not vary with
  227.      position in the Z range, so the reference point is ignored.
  228.  
  229.      GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS is part of the SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc extension, not part of the
  230.      core GL command set.  If GGGGLLLL____SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc is included in the string
  231.      returned by ffffggggllllGGGGeeeettttSSSSttttrrrriiiinnnngggg when called with argument GGGGLLLL____EEEEXXXXTTTTEEEENNNNSSSSIIIIOOOONNNNSSSS,
  232.      extension SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc is supported by the connection.  See ffffggggllllIIIInnnnttttrrrroooo for
  233.      more information about using extensions.
  234.  
  235.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX is part of the SSSSGGGGIIIIXXXX____ffffoooogggg____ooooffffffffsssseeeetttt extension, and
  236.      similar considerations apply.
  237.  
  238. EEEERRRRRRRROOOORRRRSSSS
  239.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _p_n_a_m_e is not an accepted value, or if
  240.      _p_n_a_m_e is GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE and _p_a_r_a_m_s is not an accepted value.
  241.  
  242.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _p_n_a_m_e is GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY and _p_a_r_a_m_s is
  243.      negative.
  244.  
  245.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ffffggggllllFFFFoooogggg is executed between the
  246.      execution of ffffggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of ffffggggllllEEEEnnnndddd.
  247.  
  248. AAAASSSSSSSSOOOOCCCCIIIIAAAATTTTEEEEDDDD GGGGEEEETTTTSSSS
  249.      ffffggggllllIIIIssssEEEEnnnnaaaabbbblllleeeedddd with argument GGGGLLLL____FFFFOOOOGGGG
  250.      ffffggggllllIIIIssssEEEEnnnnaaaabbbblllleeeedddd with argument GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____SSSSGGGGIIIIXXXX
  251.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR
  252.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS
  253.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____MMMMAAAAXXXX____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____PPPPOOOOIIIINNNNTTTTSSSS____SSSSGGGGIIIISSSS
  254.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX
  255.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY
  256.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT
  257.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD
  258.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE
  259.      ffffggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX
  260.  
  261.  
  262. MMMMAAAACCCCHHHHIIIINNNNEEEE DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
  263.      Fog mode GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS is supported only on InfiniteReality systems.
  264.  
  265.      The fog offset capability is supported only on InfiniteReality systems.
  266.  
  267.      On InfiniteReality systems, fog cannot be used with color-index visuals
  268.      that are 2 or 4 bits deep.  Accordingly, these visuals are marked as
  269.      non-conforming.
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.                                                                         PPPPaaaaggggeeee 4444
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283. ffffggggllllFFFFoooogggg((((3333GGGG))))                     OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                     ffffggggllllFFFFoooogggg((((3333GGGG))))
  284.  
  285.  
  286.  
  287. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  288.      ffffggggllllEEEEnnnnaaaabbbblllleeee, ffffggggllllFFFFooooggggFFFFuuuunnnnccccSSSSGGGGIIIISSSS
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.                                                                         PPPPaaaaggggeeee 5555
  343.  
  344.  
  345.  
  346.